﻿
@{
    //购物车
    ViewBag.Title = "ShopCar";
    Layout = "~/Views/Home/_HomeLayout.cshtml";
}
@section Head{
    <style type="text/css">
        .dept_select {
            min-width: 200px;
        }
    </style>
}
<div class="container">
    <div class="row clearfix">
        <div class="col-md-2 column">
            <div class="panel-group">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <a class="panel-title" data-toggle="collapse" href="#son1">账号管理</a>
                    </div>
                    <div id="son1" class="panel-collapse in">
                        @*collapse默认关闭*@
                        <div class="panel-body">
                            <div class="bs-example" data-example-id="vertical-button-group">
                                <div class="btn-group-vertical" role="group" aria-label="Vertical button group">
                                    <a href="@Url.Action("UserInfo","Home")" class="btn btn-link">个人信息</a>
                                    <a href="@Url.Action("UpdateUserInfo","Home")" class="btn btn-link">修改个人信息</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <a class="panel-title" data-toggle="collapse" href="#son2">购物管理</a>
                    </div>
                    <div id="son2" class="panel-collapse in">
                        <div class="panel-body">
                            <div class="bs-example" data-example-id="vertical-button-group">
                                <div class="btn-group-vertical" role="group" aria-label="Vertical button group">
                                    <a href="@Url.Action("ShopCar","Home")" class="btn btn-link">购物车管理</a>
                                    <a href="@Url.Action("UserOrder","Home")" class="btn btn-link">订单管理</a>
                                  
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-10 column">
            <div id="Car">
              @Html.Action("_ShopCar", "Home")
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    //删除购物车中的东西
    function delshopcar(BCID) {
        var gnl = confirm("确定要删除吗?");
        if (gnl == true) {
            $.ajax({
                url: '@Url.Action("DelShopCar")',
                type: 'post',
                dataType: 'text',
                data: { BCID: BCID },
                async: false,
                success: function (data) {
                    if (data == 'NO') {
                        alert("删除失败");
                    }
                    if (data == "User")
                    {
                        alert("无效的用户状态，请重新登陆");
                        location.href = "@Url.Action("UsersLogin","User")";
                    }
                    else {
                        showcar();
                        HomeShopCar();
                    }
                },
                error: function () {
                    alert("Ajax调用出错请与管理员联系");
                }
            });
        }

    }
    function showcar()
    {
        $.ajax({
            cache: false,
            type: 'post',
            url: '@Url.Action("_ShopCar")',
            dataType: 'text',
            success: function (data) {
                $("#Car").html(data);
            },
            error: function () {
                alert("Ajax调用出错请与管理员联系");
            }
        });
    }
</script>